#!/bin/bash
#
# /etc/rc.d/init.d/kindo-hub
# init script for kindo-hub precesses
#
# processname: kindo-hub
# description: kindo-hub is a mircoservice
# chkconfig: 2345 86 16
# description:  Start up the kindo-hub Service.

if [ -f /etc/init.d/functions ]; then
        . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
        . /etc/rc.d/init.d/functions
else
        echo -e "/atomcat: unable to locate functions lib. Cannot continue."
        exit -1
fi

RETVAL=$?
SERVICE_HOME="/usr/local/kindo-hub/${project.version}"

case "$1" in
start)
        if [ -f $SERVICE_HOME/bin/start.sh ];
          then
            echo $"Starting kindo-hub"
            $SERVICE_HOME/bin/start.sh
        fi
        ;;
stop)
        if [ -f $SERVICE_HOME/bin/stop.sh ];
          then
            echo $"Stopping kindo-hub"
            $SERVICE_HOME/bin/stop.sh
        fi
        ;;
restart)
        if [ -f $SERVICE_HOME/bin/stop.sh ];
          then
            echo $"Stopping kindo-hub"
            $SERVICE_HOME/bin/stop.sh
        fi

        if [ -f $SERVICE_HOME/bin/start.sh ];
          then
            echo $"Starting kindo-hub"
            $SERVICE_HOME/bin/start.sh
        fi
        ;;
*)
        echo $"Usage: $0 {start|stop}"
        exit 1
        ;;
esac

exit $RETVAL
